package two_pointer.leetcode_80_medium;

public class RemoveDuplicates {
    public static void main(String[] args) {
        int[] nums = {0, 0, 1, 1, 1, 1, 2, 3, 3};
    }

    public int removeDuplicates(int[] nums) {
        if (nums.length == 0) {
            return 0;
        }
        int i = 1;
        for (int j = 2; j < nums.length; j++) {
            if (nums[i - 1] != nums[j]) {
                nums[++i] = nums[j];
            }
        }
        return i + 1;
    }
}
